package cn.edu.fzu.homemaking.domain.enums;

/**
 * @author jiebin
 * @date 2023/4/6
 */

public enum OrderStatusEnum {

    REFUND(-2, "已退款"),
    CANCEL(-1, "已取消"),
    ORDER(0, "已下单"),
    DISPATCH(1, "已派遣人员"),
    GOING(2, "进行中"),
    PAYING(3,"待支付"),
    ENDED(4, "已结束");

    private final int value;

    private final String desc;

    OrderStatusEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public int getValue(){
        return value;
    }

    public String getDesc(){
        return desc;
    }

    public static OrderStatusEnum parse(int value){
        switch (value){
            case -2:
                return REFUND;
            case -1:
                return CANCEL;
            case 0:
                return ORDER;
            case 1:
                return DISPATCH;
            case 2:
                return GOING;
            case 3:
                return PAYING;
            case 4:
                return ENDED;
            default:
                return null;
        }
    }
}
